﻿<%@ Page Language="C#" MasterPageFile="~/Admin/admin.master" AutoEventWireup="true"
    CodeFile="DrugDispoEdit.aspx.cs" Inherits="DrugDispoEdit" Title="DrugDispo Edit" %>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" runat="Server">
    Drug Dispo - Add/Edit</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <data:MultiFormView ID="FormView1" DataKeyNames="DrugId" runat="server" DataSourceID="DrugDispoDataSource">
        <EditItemTemplatePaths>
            <data:TemplatePath Path="~/Admin/UserControls/DrugDispoFields.ascx" />
        </EditItemTemplatePaths>
        <InsertItemTemplatePaths>
            <data:TemplatePath Path="~/Admin/UserControls/DrugDispoFields.ascx" />
        </InsertItemTemplatePaths>
        <EmptyDataTemplate>
            <b>DrugDispo not found!</b>
        </EmptyDataTemplate>
        <FooterTemplate>
            <asp:Button ID="InsertButton" runat="server" CausesValidation="True" CommandName="Insert"
                CssClass="button" Text="Insert" Visible="False" />
            <asp:Button ID="UpdateButton" runat="server" CausesValidation="True" CommandName="Update"
                CssClass="button" Text="Update" Visible="False" />
            <asp:Button ID="CancelButton" runat="server" CausesValidation="False" CommandName="Cancel"
                CssClass="button" Text="Cancel"/>
        </FooterTemplate>
    </data:MultiFormView>
    <data:DrugDispoDataSource ID="DrugDispoDataSource" runat="server" SelectMethod="GetByDrugId">
        <Parameters>
            <asp:QueryStringParameter Name="DrugId" QueryStringField="DrugId" Type="String" />
        </Parameters>
    </data:DrugDispoDataSource>
    <br />
    <data:EntityGridView ID="GridViewGrnDetails1" runat="server" AutoGenerateColumns="False"
        OnSelectedIndexChanged="GridViewGrnDetails1_SelectedIndexChanged" DataSourceID="GrnDetailsDataSource1"
        DataKeyNames="GrnDetailId" AllowMultiColumnSorting="false" DefaultSortColumnName=""
        DefaultSortDirection="Ascending" ExcelExportFileName="Export_GrnDetails.xls"
        Visible='<%# (FormView1.DefaultMode == FormViewMode.Insert) ? false : true %>'>
        <Columns>
            <asp:CommandField ShowSelectButton="True" />
            <data:HyperLinkField HeaderText="Grn Id" DataNavigateUrlFormatString="GrnEdit.aspx?GrnId={0}"
                DataNavigateUrlFields="GrnId" DataContainer="GrnIdSource" DataTextField="GrnId" />
            <data:HyperLinkField HeaderText="Drug Id" DataNavigateUrlFormatString="DrugDispoEdit.aspx?DrugId={0}"
                DataNavigateUrlFields="DrugId" DataContainer="DrugIdSource" DataTextField="DrugName" />
            <asp:BoundField DataField="Quantity" HeaderText="Quantity" SortExpression="[Quantity]" />
            <asp:BoundField DataField="UnitPrice" HeaderText="Unit Price" SortExpression="[UnitPrice]" />
            <asp:BoundField DataField="ExpDate" HeaderText="Exp Date" SortExpression="[ExpDate]" />
            <asp:BoundField DataField="BatchLot" HeaderText="Batch Lot" SortExpression="[BatchLot]" />
            <asp:BoundField DataField="Remark" HeaderText="Remark" SortExpression="[Remark]" />
        </Columns>
        <EmptyDataTemplate>
            <b>No Grn Details Found! </b>
            <asp:HyperLink runat="server" ID="hypGrnDetails" NavigateUrl="~/admin/GrnDetailsEdit.aspx">Add New</asp:HyperLink>
        </EmptyDataTemplate>
    </data:EntityGridView>
    <data:GrnDetailsDataSource ID="GrnDetailsDataSource1" runat="server" SelectMethod="Find"
        EnableDeepLoad="True" EnablePaging="True">
        <DeepLoadProperties Method="IncludeChildren" Recursive="False">
            <Types>
                <data:GrnDetailsProperty Name="DrugDispo" />
                <data:GrnDetailsProperty Name="Grn" />
            </Types>
        </DeepLoadProperties>
        <Parameters>
            <data:SqlParameter Name="Parameters">
                <Filters>
                    <data:GrnDetailsFilter Column="DrugId" QueryStringField="DrugId" />
                </Filters>
            </data:SqlParameter>
            <data:CustomParameter Name="OrderByClause" Value="" ConvertEmptyStringToNull="false" />
        </Parameters>
    </data:GrnDetailsDataSource>
    <br />
    <data:EntityGridView ID="GridViewStock2" runat="server" AutoGenerateColumns="False"
        OnSelectedIndexChanged="GridViewStock2_SelectedIndexChanged" DataSourceID="StockDataSource2"
        DataKeyNames="DrugId, ExpDate, BatchLot" AllowMultiColumnSorting="false" DefaultSortColumnName=""
        DefaultSortDirection="Ascending" ExcelExportFileName="Export_Stock.xls" Visible='<%# (FormView1.DefaultMode == FormViewMode.Insert) ? false : true %>'>
        <Columns>
            <asp:CommandField ShowSelectButton="True" />
            <data:HyperLinkField HeaderText="Drug Id" DataNavigateUrlFormatString="DrugDispoEdit.aspx?DrugId={0}"
                DataNavigateUrlFields="DrugId" DataContainer="DrugIdSource" DataTextField="DrugName" />
            <asp:BoundField DataField="Quantity" HeaderText="Quantity" SortExpression="[Quantity]" />
            <asp:BoundField DataField="ExpDate" HeaderText="ExpDate" SortExpression="[ExpDate]" />
            <asp:BoundField DataField="UnitPrice" HeaderText="Unit Price" SortExpression="[UnitPrice]" />
            <asp:BoundField DataField="Remark" HeaderText="Remark" SortExpression="[Remark]" />
        </Columns>
        <EmptyDataTemplate>
            <b>No Stock Found! </b>
            <asp:HyperLink runat="server" ID="hypStock" NavigateUrl="~/admin/StockEdit.aspx">Add New</asp:HyperLink>
        </EmptyDataTemplate>
    </data:EntityGridView>
    <data:StockDataSource ID="StockDataSource2" runat="server" SelectMethod="Find" EnableDeepLoad="True">
        <DeepLoadProperties Method="IncludeChildren" Recursive="False">
            <Types>
                <data:StockProperty Name="DrugDispo" />
            </Types>
        </DeepLoadProperties>
        <Parameters>
            <data:SqlParameter Name="Parameters">
                <Filters>
                    <data:StockFilter Column="DrugId" QueryStringField="DrugId" />
                </Filters>
            </data:SqlParameter>
            <data:CustomParameter Name="OrderByClause" Value="" ConvertEmptyStringToNull="false" />
        </Parameters>
    </data:StockDataSource>
    <br />
    <data:EntityGridView ID="GridViewDrugDiscount3" runat="server" AutoGenerateColumns="False"
        OnSelectedIndexChanged="GridViewDrugDiscount3_SelectedIndexChanged" DataSourceID="DrugDiscountDataSource3"
        DataKeyNames="MemberType, DrugId" AllowMultiColumnSorting="false" DefaultSortColumnName=""
        DefaultSortDirection="Ascending" ExcelExportFileName="Export_DrugDiscount.xls"
        Visible='<%# FormView1.DefaultMode != FormViewMode.Insert %>'>
        <Columns>
            <asp:CommandField ShowSelectButton="True" />
            <data:HyperLinkField HeaderText="Drug Id" DataNavigateUrlFormatString="DrugDispoEdit.aspx?DrugId={0}"
                DataNavigateUrlFields="DrugId" DataContainer="DrugIdSource" DataTextField="DrugName" />
            <asp:BoundField DataField="DiscountPercent" HeaderText="Discount Percent" SortExpression="[DiscountPercent]" />
            <asp:BoundField DataField="Remark" HeaderText="Remark" SortExpression="[Remark]" />
        </Columns>
        <EmptyDataTemplate>
            <b>No Drug Discount Found! </b>
            <asp:HyperLink runat="server" ID="hypDrugDiscount" NavigateUrl="~/admin/DrugDiscountEdit.aspx">Add New</asp:HyperLink>
        </EmptyDataTemplate>
    </data:EntityGridView>
    <data:DrugDiscountDataSource ID="DrugDiscountDataSource3" runat="server" SelectMethod="Find"
        EnableDeepLoad="True">
        <DeepLoadProperties Method="IncludeChildren" Recursive="False">
            <Types>
                <data:DrugDiscountProperty Name="DrugDispo" />
            </Types>
        </DeepLoadProperties>
        <Parameters>
            <data:SqlParameter Name="Parameters">
                <Filters>
                    <data:DrugDiscountFilter Column="DrugId" QueryStringField="DrugId" />
                </Filters>
            </data:SqlParameter>
            <data:CustomParameter Name="OrderByClause" Value="" ConvertEmptyStringToNull="false" />
        </Parameters>
    </data:DrugDiscountDataSource>
    <br />
    <data:EntityGridView ID="GridViewPrescriptionDetail4" runat="server" AutoGenerateColumns="False"
        OnSelectedIndexChanged="GridViewPrescriptionDetail4_SelectedIndexChanged" DataSourceID="PrescriptionDetailDataSource4"
        DataKeyNames="PrescriptionDetailId" AllowMultiColumnSorting="false" DefaultSortColumnName=""
        DefaultSortDirection="Ascending" ExcelExportFileName="Export_PrescriptionDetail.xls"
        Visible='<%# (FormView1.DefaultMode == FormViewMode.Insert) ? false : true %>'>
        <Columns>
            <asp:CommandField ShowSelectButton="True" />
            <data:HyperLinkField HeaderText="Prescription Id" DataNavigateUrlFormatString="PrescriptionEdit.aspx?PrescriptionId={0}"
                DataNavigateUrlFields="PrescriptionId" DataContainer="PrescriptionIdSource" DataTextField="PatientCode" />
            <data:HyperLinkField HeaderText="Drug Id" DataNavigateUrlFormatString="DrugDispoEdit.aspx?DrugId={0}"
                DataNavigateUrlFields="DrugId" DataContainer="DrugIdSource" DataTextField="DrugName" />
            <asp:BoundField DataField="DrugName" HeaderText="Drug Name" SortExpression="[DrugName]" />
            <asp:BoundField DataField="Unit" HeaderText="Unit" SortExpression="[Unit]" />
            <asp:BoundField DataField="Quantity" HeaderText="Quantity" SortExpression="[Quantity]" />
            <asp:BoundField DataField="CostPrice" HeaderText="Cost Price" SortExpression="[CostPrice]" />
            <asp:BoundField DataField="UnitPrice" HeaderText="Unit Price" SortExpression="[UnitPrice]" />
            <asp:BoundField DataField="ExpDate" HeaderText="Exp Date" SortExpression="[ExpDate]" />
            <asp:BoundField DataField="BatchLot" HeaderText="Batch Lot" SortExpression="[BatchLot]" />
            <asp:BoundField DataField="Remark" HeaderText="Remark" SortExpression="[Remark]" />
        </Columns>
        <EmptyDataTemplate>
            <b>No Prescription Detail Found! </b>
            <asp:HyperLink runat="server" ID="hypPrescriptionDetail" NavigateUrl="~/admin/PrescriptionDetailEdit.aspx">Add New</asp:HyperLink>
        </EmptyDataTemplate>
    </data:EntityGridView>
    <data:PrescriptionDetailDataSource ID="PrescriptionDetailDataSource4" runat="server"
        SelectMethod="Find" EnableDeepLoad="True">
        <DeepLoadProperties Method="IncludeChildren" Recursive="False">
            <Types>
                <data:PrescriptionDetailProperty Name="DrugDispo" />
                <data:PrescriptionDetailProperty Name="Prescription" />
            </Types>
        </DeepLoadProperties>
        <Parameters>
            <data:SqlParameter Name="Parameters">
                <Filters>
                    <data:PrescriptionDetailFilter Column="DrugId" QueryStringField="DrugId" />
                </Filters>
            </data:SqlParameter>
            <data:CustomParameter Name="OrderByClause" Value="" ConvertEmptyStringToNull="false" />
        </Parameters>
    </data:PrescriptionDetailDataSource>
    <br />
    <data:EntityGridView ID="GridViewStockOutDetails1" runat="server" AutoGenerateColumns="False"
        OnSelectedIndexChanged="GridViewStockOutDetails1_SelectedIndexChanged" DataSourceID="StockOutDetailsDataSource1"
        DataKeyNames="StockOutDetailId" AllowMultiColumnSorting="false" DefaultSortColumnName=""
        DefaultSortDirection="Ascending" ExcelExportFileName="Export_StockOutDetails.xls"
        Visible='<%# (FormView1.DefaultMode == FormViewMode.Insert) ? false : true %>'>
        <Columns>
            <asp:CommandField ShowSelectButton="True" />
            <data:HyperLinkField HeaderText="Stock Out Id" DataNavigateUrlFormatString="StockOutEdit.aspx?StockOutId={0}"
                DataNavigateUrlFields="StockOutId" DataContainer="StockOutIdSource" DataTextField="StockOutId" />
            <asp:BoundField DataField="DrugId" HeaderText="Drug Id" SortExpression="[DrugId]" />
            <asp:BoundField DataField="Quantity" HeaderText="Quantity" SortExpression="[Quantity]" />
            <asp:BoundField DataField="UnitPrice" HeaderText="Unit Price" SortExpression="[UnitPrice]" />
            <asp:BoundField DataField="ExpDate" HeaderText="Exp Date" SortExpression="[ExpDate]" />
            <asp:BoundField DataField="BatchLot" HeaderText="Batch Lot" SortExpression="[BatchLot]" />
            <asp:BoundField DataField="Remark" HeaderText="Remark" SortExpression="[Remark]" />
        </Columns>
        <EmptyDataTemplate>
            <b>No Stock Out Details Found! </b>
            <asp:HyperLink runat="server" ID="hypStockOutDetails" NavigateUrl="~/admin/StockOutDetailsEdit.aspx">Add New</asp:HyperLink>
        </EmptyDataTemplate>
    </data:EntityGridView>
    <data:StockOutDetailsDataSource ID="StockOutDetailsDataSource1" runat="server" SelectMethod="Find"
        EnableDeepLoad="True">
        <DeepLoadProperties Method="IncludeChildren" Recursive="False">
            <Types>
                <data:StockOutDetailsProperty Name="StockOut" />
            </Types>
        </DeepLoadProperties>
        <Parameters>
            <data:SqlParameter Name="Parameters">
                <Filters>
                    <data:StockOutDetailsFilter Column="DrugId" QueryStringField="DrugId" />
                </Filters>
            </data:SqlParameter>
            <data:CustomParameter Name="OrderByClause" Value="" ConvertEmptyStringToNull="false" />
        </Parameters>
    </data:StockOutDetailsDataSource>
    <br />
</asp:Content>
